package zxing.android;

import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import io.virtualapp.R;
import io.virtualapp.abs.ui.VActivity;
import io.virtualapp.mylibrary.util.ToastUtils;

public class ScanningResultActivity extends VActivity {
    @BindView(R.id.head_back)
    ImageView head_back;
    @BindView(R.id.head_center_title)
    TextView head_center_title;
    @BindView(R.id.text_result)
    TextView text_result;
    String str;
    @BindView(R.id.button_cope)
    Button button_cope;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_scanning_result);
        ButterKnife.bind(this);
        Intent intent = getIntent();
        str = intent.getStringExtra("codedContent");
        text_result.setText(str + "");
        initView();
    }

    public void initView() {
        ClipboardManager clip = (ClipboardManager)getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
        head_center_title.setText("扫描结果");
        head_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        button_cope.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ToastUtils.showShortToast("已复制到粘贴板");
                clip.setText(str+"");
            }
        });
    }
}
